package com.huike.clues.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.xiaoymin.knife4j.core.util.StrUtil;
import com.huike.clues.domain.TbActivity;
import com.huike.clues.domain.dto.TbActivityDTO;
import com.huike.clues.service.TbActivityService;
import com.huike.clues.mapper.TbActivityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @author 93238
 * @description 针对表【tb_activity(活动管理)】的数据库操作Service实现
 * @createDate 2023-10-12 06:35:46
 */
@Service
public class TbActivityServiceImpl extends ServiceImpl<TbActivityMapper, TbActivity>
        implements TbActivityService {

@Autowired
private TbActivityMapper tbActivityMapper;
    /**
     * 分页查询
     *
     * @param tbActivity
     * @return
     */
   @Override
public List<TbActivity> selectbyid(TbActivity tbActivity) {
    List<TbActivity> list = this.lambdaQuery()
            .eq(tbActivity.getId() != null, TbActivity::getId, tbActivity.getId())
            .eq(StrUtil.isNotBlank(tbActivity.getName()), TbActivity::getName, tbActivity.getName())
            .eq(StrUtil.isNotBlank(tbActivity.getCode()), TbActivity::getCode, tbActivity.getCode())
            .eq(StrUtil.isNotBlank(tbActivity.getChannel()), TbActivity::getChannel, tbActivity.getChannel())
            .ge(tbActivity.getBeginTime() != null, TbActivity::getBeginTime, tbActivity.getBeginTime())
            .le(tbActivity.getEndTime() != null, TbActivity::getEndTime, tbActivity.getEndTime())
            .list();

    return list;
}
}




